package com.hoioy.findjob.jihe;

import sun.misc.Unsafe;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.Semaphore;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;


public class Test {
    public static void main(String[] args) throws InterruptedException {
        Semaphore a = new Semaphore(3);
        ReentrantLock lock = new ReentrantLock();
        lock.lock();

        lock.unlock();

//        int aa = 1 / 0;
        Thread.sleep(100000);
//        ThreadPoolExecutor
//        StringBuilder ss = new StringBuilder("aaaa");
//        System.out.println(ss.hashCode());
//        ss.append("dddd");
//        System.out.println(ss.hashCode());
//
//        char[] aa = "".toCharArray();
//
//
//        String a = new String("aaaa");
//        System.out.println(a.hashCode());
//        Thread.sleep(100);
//        new Date().hashCode();
////Thread.State.BLOCKED
//        a.replace("a", "d");
//        System.out.println(a);
//        System.out.println(a.hashCode());
//
//        Object aa = new Object();
//        Object bb = new Object();
//
//        System.out.println(aa.hashCode());
//        System.out.println(bb.hashCode());
//
//        System.out.println(Integer.MAX_VALUE);
//        System.out.println(Long.MAX_VALUE);
//
//        BigInteger bigInteger = BigInteger.valueOf(122423423423l);
//        BigInteger bigInteger1 = new BigInteger("974289347091837409182743093434523452345234523453245812");
//        System.out.println(bigInteger1);
//        System.out.println(bigInteger1.add(bigInteger));

//        String aaa = "asdfasdf---asdfadfa---jasiodfjaosidfj";
//        List r = deleteRec(aaa);
//        System.out.println(r);//转字符串
    }

    public static List deleteRec(String src) {
        List<Character> ll = charArrayToList(src.toCharArray());
        List<Character> result = new ArrayList();

        ll.forEach(i -> {
            if (i.equals('-')) {
                if (result.size() > 0) {
                    //删除最后一个
                    result.remove(result.size() - 1);
                }
            } else {
                result.add(i);
            }
        });

        //
        return result;

    }

    public static List<Character> charArrayToList(char[] charArray) {
        //非空判断
        // 循环
        List<Character> r = new ArrayList<>();
        for (int i = 0; i < charArray.length; i++) {
            r.add(charArray[i]);
        }
        return r;
    }
}
